#include <stdio.h>
#include <stdlib.h>

#include <queue.h>

#define NAMESIZE 32
struct score_st
{
	int id;
	char name[NAMESIZE];
	int chinese;
	int math;
};
static void print_s(struct score_st *tmp)
{

	printf("%d %s %d %d\n",tmp->id,tmp->name,tmp->math,tmp->chinese);
}
int main()
{
	QUEUE *st;
	struct score_st tmp;
	st = queue_create(sizeof(struct score_st));
	if (st == NULL)
		exit(1);
	int i = 0;
	for (i=0;i<6;i++)
	{
		tmp.id = i;
		snprintf(tmp.name,NAMESIZE,"stu%d",i);
		tmp.math = rand()%100;
		tmp.chinese = rand()%100;
		if (queue_en(st,&tmp) != 0)
			break;
	}
	int ret = 0;
	struct score_st tmp2;
	while(1)
	{
		ret = queue_de(st,&tmp2);
		if (ret == -1)
			break;

		print_s(&tmp2);
	}

	queue_destroy(st);


	exit(0);
}
